package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduSendMessage.EduSendMessageKeyVO;
import com.jwsoft.manager.common.vo.eduSendMessage.EduSendMessageQueryVO;
import com.jwsoft.manager.common.vo.eduSendMessage.EduSendMessageVO;
import com.jwsoft.manager.core.integration.EduSendMessageIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 短信发送表网关
 *
 * @author zjl
 * @since 2024-06-21
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "短信发送表", description = "短信发送表")
public class EduSendMessageController {

    @Autowired
    public EduSendMessageIntegration eduSendMessageIntegration;

    @Operation(summary = "短信发送表分页查询", description = "短信发送表分页查询")
    @PostMapping(value = "/eduSendMessage0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduSendMessageVO>> getList(@RequestBody @Validated EduSendMessageQueryVO vo) {
        return AppResponse.successData(eduSendMessageIntegration.getList(vo));
    }

    @Operation(summary = "短信发送表根据主键查询详情", description = "短信发送表根据主键查询详情")
    @PostMapping(value = "/eduSendMessage0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSendMessageVO> getById(@RequestBody @Validated EduSendMessageKeyVO vo) {
        return AppResponse.successData(eduSendMessageIntegration.getById(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "短信发送表新增", description = "短信发送表新增")
    @PostMapping(value = "/eduSendMessage0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSendMessageVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduSendMessageVO vo) {
        return AppResponse.successData(eduSendMessageIntegration.add(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "短信发送表修改", description = "短信发送表修改")
    @PostMapping(value = "/eduSendMessage0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduSendMessageVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduSendMessageVO vo) {
        return AppResponse.successData(eduSendMessageIntegration.edit(vo));
    }

    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "短信发送表删除", description = "短信发送表删除")
    @PostMapping(value = "/eduSendMessage0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduSendMessageKeyVO vo) {
        eduSendMessageIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "推送录取信息到短信内容表", description = "短信发送表删除")
    @PostMapping(value = "/eduSendMessage0007", produces = "application/json;charset=UTF-8")
    public AppResponse pushMessageToContent(@RequestBody @Validated EduSendMessageVO vo) {
        return AppResponse.successData(eduSendMessageIntegration.pushMessageToContent(vo));
    }
}
